package com.neulogistics.contrib.transfercenter.domain.exception;

import com.neulogistics.infrastructure.common.serviceresult.ErrorCode;
import com.neulogistics.infrastructure.ddd.domain.exceptions.DomainException;

public class TransferCenterDomainException extends DomainException {
    private final int code;

    public TransferCenterDomainException(int code) {
        this.code = code;
    }

    public TransferCenterDomainException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        code = errorCode.getCode();
    }

    public TransferCenterDomainException(ErrorCode errorCode, String message) {
        super(message);
        code = errorCode.getCode();
    }

    public TransferCenterDomainException(ErrorCode errorCode, Exception innerException){
        super(errorCode.getMessage(), innerException);
        code = errorCode.getCode();
    }

    public int getCode() {
        return code;
    }
}
